package cn.chencq.proxy.util;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import cn.chencq.proxy.constants.RedisKey;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.limei.adplatform.redis.cluster.RedisClusterFactory;

public class ProxyCacheUtil {

	private static LoadingCache<Page, Set<String>> proxyCache = CacheBuilder.newBuilder()
			.expireAfterAccess(10, TimeUnit.SECONDS)
			.refreshAfterWrite(10, TimeUnit.SECONDS)
			.build(new CacheLoader<Page, Set<String>>() {

				@Override
				public Set<String> load(Page page) throws Exception {
		
					String clusterName = RedisKey.getClusterName();
					String key = RedisKey.getDayProxyKey();
		
					Set<String> set = RedisClusterFactory.smembers(clusterName, key);
		
					Set<String> res = new HashSet<String>();
					
					int start = 0;
					int end = 0;
					for (int i = start; i < end; i++) {
						
					}
					
					return res;
				}
				
	 });
}
